package com.didibigdata.servlets;

import com.didibigdata.Repositories.HeatMapRepository;
import com.didibigdata.entities.OrderODGPS;
import com.didibigdata.utils.GPSUtil;
import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/OrderStopServlet")
public class OrderStopServlet extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        HeatMapRepository heatMapRepository = new HeatMapRepository();
        List<OrderODGPS> orderStartList = heatMapRepository.getOrderODGPS("t_orderstop");
        ObjectMapper mapper = new ObjectMapper();
        String json = mapper.writeValueAsString(orderStartList);
        response.setContentType("text/html; charset=utf-8");
        response.getWriter().write(json);
    }
}
